<div class="main-page">    
    <div class="game-info">
        <a href="<?php echo Yii::app()->createUrl('game/'.$model[0]->game->slug); ?>">
            <img src="<?php echo Yii::app()->createUrl('files/games/'.$model[0]->game->image); ?>"/>
            <div class="game-info-details">
                <div class="game-info-item game-info-name"><?php echo $model[0]->game->name ?></div> 
                <div class="game-info-item"><span>Version: </span><?php if(($model[0]->game->getCurrentVersion($device))) echo $model[0]->game->getCurrentVersion($device)->getCurrentVersion(); else echo "N/A"; ?></div>            
                <div class="game-info-item"><span>Dung lượng: </span><?php if(($model[0]->game->getCurrentVersion($device))) echo $model[0]->game->getCurrentVersion($device)->getSize(); else echo "N/A"?></div>
                <div class="game-info-item"><span>Số lượt tải: </span><?php  echo $model[0]->game->countDownload;?></div>
            </div>
        </a>    
    </div>
    
    <section class="group-download">
        <ul>
            <?php if($device == "ios"):?>
            <li><nav><a href="<?php if($model[0]->game->getCurrentVersion('ios')) echo $model[0]->game->getCurrentVersion('ios')->gamePlatform->market_url ?>" class="market-apple" id="download_market"><img src="<?php echo Yii::app()->createUrl('css/images/apple_down.png') ?>">Appstore</a></nav></li>            
            <?php elseif($device =="android"):?>
            <li><nav><a href="<?php if($model[0]->game->getCurrentVersion('android')) echo $model[0]->game->getCurrentVersion('android')->gamePlatform->market_url ?>" class="market-google" id="download_market"><img src="<?php echo Yii::app()->createUrl('css/images/android_down.png') ?>">Playstore</a></nav></li>            
            <?php else:?>
            <?php endif;?>
            <li><nav><a href="<?php echo Yii::app()->createUrl('site/download?game='.$model[0]->game->code_identifier); ?>" class="not-market" id="download_not_market"><img src="<?php echo Yii::app()->createUrl('css/images/tai.png') ?>">Tải trực tiếp</a></nav></li>
        </ul>
    </section>   
    
    <div class="game-description">
        <?php echo $model[0]->game->sapo; ?>
    </div>
</div>

<?php if(isset($banners)):?>
<div class="slide">
    <a class="slide-prev"></a> 
    <a class="slide-next"></a>
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <?php foreach($banners as $item):?>
            <div class="swiper-slide"><a href="<?php echo $item->link ?>"><img src="<?php echo Yii::app()->createUrl($item->file) ?>"></a></div>        
        <?php endforeach;?>
      </div>
     </div>            
</div>

<script type="text/javascript">          
    var mySwiper = new Swiper('.swiper-container',{    
    loop:true,
    grabCursor: true,
    autoplay: 3000
  })
  $('.slide-prev').on('click', function(e){
    e.preventDefault()
    mySwiper.swipePrev()
  })
  $('.slide-next').on('click', function(e){
    e.preventDefault()
    mySwiper.swipeNext()
  })   
</script>  
<?php endif;?>
<div class="separator"><span>GAME KHÁC</span></div>

<div class="main-page">  
    <?php if(isset($model) && count($model) > 1): ?>
    <?php foreach($model as $index => $item):?>
    <?php if($index != 0):?>
        <div class="row2 clearfix row2_1 r_1">
            <div class="left" align="center">
                <a href="<?php echo Yii::app()->createUrl('game/'.$item->game->slug); ?>">
                    <?php if($item->game->hot == 1):?>
                    <span class="ribbon ribbon_hot"></span>
                    <?php endif;?>
                    <img src="<?php echo Yii::app()->createAbsoluteUrl('files/games/'.$item->game->image) ?>" class="icon">
                </a>
           </div>
           <div class="right right_1" align="right">
                <a href="<?php echo Yii::app()->createUrl('game/'.$item->game->slug); ?>"></a>
           </div>
           <div class="info">
                <a href="<?php echo Yii::app()->createUrl('game/'.$item->game->slug); ?>">
                    <div class="name"><?php echo $item->game->name ?></div>
                    <div class="mid_info"><?php echo $item->game->sapo ?></div>                    
                    <span class="button-detail"></span>
                </a>                 
                <div class="download-button">
                    <span class="bottom_info"><img src="<?php echo Yii::app()->createAbsoluteUrl('css/images/tai.png') ?>" style="margin-left: 15px;"><?php echo $item->game->countDownload  ?></span>
                    <a class="download_1 position1" href="<?php echo Yii::app()->createUrl('site/download?game='.$item->game->code_identifier); ?>"><span>Tải ngay</span></a>                
                </div>
           </div>           
        </div>
    <?php endif;?>
    <?php endforeach; ?>
    <?php endif; ?>
</div>

